package net.goutalk.glcs.module.erpModel.caseErpUnit.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl;
import net.goutalk.glcs.module.erpModel.caseErpUnit.entity.CaseErpUnit;
import net.goutalk.glcs.module.erpModel.caseErpUnit.entity.CaseErpUnitType;
import net.goutalk.glcs.module.erpModel.caseErpUnit.mapper.CaseErpUnitTypeMapper;
import net.goutalk.glcs.module.erpModel.caseErpUnit.service.ICaseErpUnitService;
import net.goutalk.glcs.module.erpModel.caseErpUnit.service.ICaseErpUnitTypeService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 单位类型【case_erp_unit_type】 服务实现类
 * </p>
 *
 * @author hnyyzy
 * @since 2023-06-13
 */
@Service
@AllArgsConstructor
public class CaseErpUnitTypeServiceImpl extends MPJBaseServiceImpl<CaseErpUnitTypeMapper, CaseErpUnitType> implements ICaseErpUnitTypeService {

    private final ICaseErpUnitService caseErpUnitService;

    @Override
    public Boolean delete(List<Long> ids) {
        //删除单位类型表数据
        this.removeBatchByIds(ids);
        //删除单位表数据
        caseErpUnitService.remove(Wrappers.<CaseErpUnit>query().lambda().in(CaseErpUnit::getUnitTypeId, ids));
        return true;
    }
}
